//
//  CalendarDayCell.m
//  SCXCalendar
//
//  Created by 桑赐相 on 2017/12/13.
//  Copyright © 2017年 桑赐相. All rights reserved.
//

#import "CalendarDayCell.h"
@interface CalendarDayCell()
@property (weak, nonatomic) IBOutlet UILabel *dayLabel;

@end
@implementation CalendarDayCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setModel:(CalendarDayModel *)model{
    _model = model;
    self.dayLabel.text = [NSString stringWithFormat:@"%ld",model.day];
    
    //是否是今天
    if(model.isCurrentDay){
        self.dayLabel.textColor = [UIColor whiteColor];
        self.contentView.backgroundColor = [UIColor colorWithRed:31/255.0f green:112/255.0f blue:207/255.0f alpha:1.0];
        self.contentView.layer.cornerRadius = 5.0;
        self.contentView.layer.masksToBounds = YES;
    }else{
        self.dayLabel.textColor = [UIColor darkGrayColor];
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.contentView.layer.cornerRadius = 0;
        //判断是否是本月
        if(model.isCurrentDate){
            self.dayLabel.textColor = [UIColor darkGrayColor];
        }else{
            self.dayLabel.textColor = [UIColor colorWithRed:180/255.0f green:180/255.0f blue:180/255.0f alpha:1.0];
        }
    }
    //判断是否是周未
    if(model.isWeekend){
        if (model.isCurrentDay) {
            self.dayLabel.textColor =[UIColor whiteColor];
        }else{
            self.dayLabel.textColor =[UIColor colorWithRed:31/255.0f green:112/255.0f blue:207/255.0f alpha:1.0];
        }
        
        if (!model.isCurrentDate) {
            self.dayLabel.textColor = [UIColor colorWithRed:111/255.0f green:192/255.0f blue:207/255.0f alpha:1.0];
        }
    }
    if(model.isSelected && model.isCurrentDate){
        self.layer.borderColor = [UIColor colorWithRed:31/255.0f green:112/255.0f blue:207/255.0f alpha:1.0].CGColor;
        self.layer.borderWidth = 1.0;
        self.layer.cornerRadius = 5.0;
    }else{
        self.layer.borderColor = [UIColor clearColor].CGColor;
        self.layer.borderWidth = 0.0;
        self.layer.cornerRadius = 0.0;
    }
}









@end
